Skip to content

Conversation

fluiderson
Copy link

Consider an example:

namespace Shapes {
  export namespace Polygons {
    export var S = 5;
  }
}

import polygons = Shapes.Polygons;

console.log(polygons.S); // 5

polygons.S = 123;

console.log(polygons.S); // 123
console.log(Shapes.Polygons.S); // 123

According to

Importantly, for values, import is a distinct reference from the original symbol, so changes to an aliased var will not be reflected in the original variable.

the S shouldn't be changed in this example, right? But it changes.

I'm not sure what "distinct reference" means exactly here. Maybe I just misinterpret this clause. Or maybe something changed in TS and it's not true anymore. Anyhow, its meaning isn't very clear.

It's also impossible to reassign an alias. Was it possible in the far past? If it is, then maybe this clause alludes to such a scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant